package com.example.bbook.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.bbook.util.HashMapTool;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.HashMap;

@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@Data
@TableName("u_order")
public class OrderEntity extends BaseEntity {
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private Integer userId;
    private String name;
    private Integer price;
    private Integer isDel;
    private String remark;
    private Integer goodsId;
    private String startTime;
    private String endTime;
    private Integer goodsNum;
    private Integer isReceive;
    private Integer isComments;
    private Integer isAfterSales;
    private String addr;

    @TableField(exist = false)
    private GoodsEntity goods;
    @TableField(exist = false)
    private SpeciesEntity orderStatus;

    public OrderEntity() {
        setColumns(new ArrayList<>());
        push("id", "number", "ID", null)
                .push("userId", "number", "用户ID", null)
                .push("name", "string", "订单编号", new int[]{0, 1, 0, 1})
                .push("price", "number", "订单价格(¥)", new int[]{1, 1, 1, 0})
                .push("startTime", "time", "开始时间", null)
                .push("endTime", "time", "结束时间", null);

    }

    public ArrayList<HashMap<String, Object>> thisColumns() {
        return getColumns();
    }
}
